home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
LOGIC Apps
/
Logic-APPLE_II_APPS.iso
/
pc
/
LOGIC Apple II 5.25" Library - DOS Part 3
/
DOS064.dsk
/
INTEREST EARNED.bas
< prev
next >
Wrap
BASIC Source File
|
2012-02-16
|
3KB
|
115 lines
1 REM - ROUND OFF FUNCTION
5 DEF FN R(X) = INT(X *100 +.5)/100
10 PRINT "EARNED INTEREST TABLE"
20 PRINT
29 REM - STATEMENTS 30 TO 230 REQUEST USER INPUT
30 PRINT "PRINCIPLE";
40 INPUT P
50 PRINT "NOMINAL INTEREST RATE";
60 INPUT I
69 REM - CONVERT PERCENT TO DECIMAL
70 I = I/100
80 PRINT "NUMBER OF DEPOSITS/WITHDRAWALS PER YEAR";
90 INPUT N1
99 REM - DON'T ASK FOR AMOUNT IF FREQUENCY IS ZERO
100 IF N1 = 0 THEN 160
108 REM - DEPOSITS ARE ENTERED AS A POSITIVE NUMBER
109 REM - WITHDRAWALS ARE ENTERED AS A NEGATIVE NUMBER
110 PRINT "AMOUNT OF DEPOSIT/WITHDRAWAL";
120 INPUT R
130 N = 360
139 REM - PRINT AT EACH DEPOSIT/WITHDRAWAL
140 L2 = N1
150 GOTO 200
160 PRINT "NUMBER OF COMPOUNDING PEROIDS PER YEAR";
170 INPUT N
180 N1 = 0
189 REM - PRINT FOUR TIMES PER YEAR
190 L2 = 4
200 PRINT "START WITH WHAT YEAR";
210 INPUT X
220 PRINT "END PRINTING WITH WHAT YEAR";
230 INPUT Y
239 REM - START PRINTING AT THE BEGINNING OF A YEAR
240 X = INT(X)
249 REM - INITIATE RUNNING TOTALS
250 B0 = P
260 I1 = 0
270 I2 = 0
280 I3 = 0
290 K = 24
300 P1 = 4
310 FOR J0 = 1 TO INT(Y) +1
319 REM - START PRINTING?
320 IF J0 <X THEN 480
329 REM - TEST FOR END OF PAGE
330 IF K <22 THEN 450
339 REM - SPACE TO NEXT PAGE, PRINT HEADINS (ASSUMED 24 LINES PER PAGE)
340 FOR K1 = K TO 24
350 PRINT
360 NEXT K1
370 K = 6
380 PRINT " EARNED INTEREST TABLE"
390 PRINT " PRINC. $";P;" AT ";I *100;"% NOMIN. FOR ";Y;" YEARS"
399 REM - SKIP DEP/WITHDRWL HEADING IF THERE ARE NONE
400 IF N1 = 0 THEN 430
410 PRINT "REGULAR DEPST./WITHDRWL $";R;" ";N1;" TIMES PER YR."
419 REM - K COUNTS THE NUMBER OF PRINTED LINES PER PAGE
420 K = K +1
430 PRINT " EFECTIVE INTEREST RATE "; FN R(100 *((1 +I/N) ^N -1));"% PER YEAR"
440 PRINT
450 PRINT "YEAR ";J0
455 PRINT
460 PRINT "BALANCE","INTRST.","ACC.INT"
465 PRINT
480 L1 = 1
490 N2 = 1
500 P2 = 1
510 FOR J1 = 1 TO N
519 REM - DEPOSIT/WITHDRAW ANY MORE THIS YEAR?
520 IF N2 >N1 THEN 560
529 REM - TIME TO MAKE DEP/WTHDRW?
530 IF N2/N1 >J1/N THEN 560
539 REM - CALCULATE NEW BALANCE
540 B0 = B0 +R
549 REM - COUNT DEPOSITS/WTHDRWLS MAKE PER YEAR
550 N2 = N2 +1
560 B2 = B0 *(1 +I/N)
569 REM - I1=AMOUNT INTEREST WITH EACH COMPOUNDING PERIOD
570 I1 = B2 -B0
579 REM - I3=AMOUNT INTEREST ACCUMULATED BETWEEN POSTING
580 I3 = I3 +I1
589 REM - I2=TOTAL INTEREST ACCUMULATED TO DATE
590 I2 = I2 +I1
599 REM - ROUND AT INTEREST POSTING TIME
600 IF P2/P1 >J1/N THEN 640
610 I2 = FN R(I2)
620 B2 = FN R(B2)
630 P2 = P2 +1
639 REM - TEAR TO START PRINTING?
640 IF J0 <X THEN 710
649 REM - TIME TO PRINT A LINE?
650 IF J1/N <L1/L2 THEN 710
660 L1 = L1 +1
670 PRINT FN R(B2), FN R(I3), FN R(I2)
679 REM - INTEREST POSTED, REINITIALIZE INTEREST ACCUM. BETWEEN POSTINGS
680 I3 = 0
690 K = K +1
699 REM - TEAR NUMBER PRINTED WITH FIRST POSTING IN EACH YEAR ONLY
700 PRINT
710 B0 = B2
719 REM - NO MORE LINES TO PRINT IN LAST YEAR
720 IF J0 +J1/N -1 > = Y THEN 780
730 NEXT J1
739 REM - START PRINTING?
740 IF J0 <X THEN 770
750 PRINT
760 K = K +1
770 NEXT J0
780 PRINT
789 REM - RESTART OR END PROGRAM?
790 PRINT "CHANGE DATA AND RECOMPUTE? (1=YES, 0=NO)";
800 INPUT Z
810 PRINT
820 IF Z = 1 THEN 20
840 PRINT "<CTRL-D>RUN HELLO"